package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 添加套餐
     * @param setmeal
     */
    void insert(Setmeal setmeal);

    /**
     * 修改套餐
     * @param setmeal
     */
    void update(Setmeal setmeal);

    /**
     * 根据id查询套餐
     * @param id
     * @return
     */
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(Integer id);

    /**
     * 分页查询
     * @param queryString
     * @return
     */
    Page<Setmeal> pageQuery(String queryString);

    /**
     * 删除套餐
     * @param id
     */
    @Delete("delete from t_setmeal where id = #{id}")
    void delete(Integer id);


    /**
     * 查询所有套餐
     * @return
     */
    @Select("select * from t_setmeal")
    List<Setmeal> findAll();
}
